We are going to take a look at 2011 data since certain datasets are not yet available for the 2021 census. It is worth noting that the LSOAs do change between census, they may have different names or change shape or new ones ma be created owing to housing developments. The Office for National Statistics (ONS) open geography portal is very useful for searching available datasets. For example they do have data tables to map from 2011 LSOAs to 2021 LSOAs.
We obtained 2011 Lower Super Output Areas (LSOA) boundaries from the ONS here. These are clipped (don’t extend into the sea etc) and generalised to 20m (slightly less detail than the actual boundaries). I downloaded these as geojson since this has a lot of tools that can be worked with, and saved them as a file called lsoa_boundaries_2011.geojson
This is a 62MB file and we are only really interested in the coastal towns. And we can start with Dover which we can extract and save like this:
# load the boundary data
lsoa_boundaries <- data.table(st_read('../data/lsoa_boundaries_2011.geojson',quiet=T))
# extract the region from the data
lsoa_boundaries$region <- str_split(lsoa_boundaries_2011$LSOA11NM, ' ', simplify = TRUE)[,1]
# extract dover
lsoa_boundaries_dover <- lsoa_boundaries[region=="Dover"]
# delete the output file if it already exists
output_fn <- "../data/lsoa_boundaries_dover_2011.geojson"
if(file.exists(output_fn)) {
file.remove(output_fn)
}
# write the dover data
st_write(lsoa_boundaries_dover, "../data/lsoa_boundaries_dover_2011.geojson")
This then saves the Dover boundaries in lsoa_boundaries_dover_2011.geojson. We can then take a look at it using the interactive mapping library tmap:
library(tmap)
library(sf)
# load in the LSOA boundaries
lsoa_dover_geojson_fn <- "../data/lsoa_boundaries_dover_2011.geojson"
# convert it to Simple Features object
dover_sf <- st_read(lsoa_dover_geojson_fn,quiet=T)
# increase max.categories otherwise we can only show a few different boundaries
tmap_options(max.categories=100)
tmap_mode("view")
# create the map
tmap_map <- tm_basemap("OpenStreetMap") +
tm_shape(dover_sf) +
tm_polygons("LSOA11CD",alpha=0.5,legend.show=F)
tmap_map
That’s more interesting, we could now take the 2011 rural-urban classification data for LSOAs and overlay that. For more information about this classification see this document. Assume we have downloaded the data, we can then merge the RUC information with the LSOA boundaries:
# load the rural-urban classes
ruc <- fread('../data/lsoa_rural_urban_classifications_2011.csv')
setkey(ruc,"LSOA11CD")
# load the LSOA boundaries for dover
lsoa_dover <- data.table(st_read("../data/lsoa_boundaries_dover_2011.geojson"))
setkey(lsoa_dover,"LSOA11CD")
# join together
lsoa_dover_plus_ruc <- lsoa_dover[ruc,nomatch=NULL]
# drop the duplicate cols
lsoa_dover_plus_ruc[, grep("^i\\.", names(lsoa_dover_plus_ruc), value=TRUE) := NULL]
# save the merger
out_fn <- "../data/lsoa_boundaries_dover_2011_plus_ruc.geojson"
if(file.exists(out_fn)) {
file.remove(out_fn)
}
st_write(lsoa_dover_plus_ruc, out_fn)
We can then plot this, note the call to tmap is very similar as before, we just use the RUC11 field to get the correct colour.
# load in the LSOA boundaries with the RUC labels
dover_plus_ruc <- "../data/lsoa_boundaries_dover_2011_plus_ruc.geojson"
# convert it to Simple Features object
dover_sf <- st_read(dover_plus_ruc,quiet=T)
# increase max.categories otherwise we can only show a few different boundaries
tmap_options(max.categories=100)
tmap_mode("view")
# create the map
tmap_map <- tm_basemap("OpenStreetMap") +
tm_shape(dover_sf) +
tm_polygons("RUC11",alpha=0.5,legend.show=T)
tmap_map
The next thing to look at is the 2011 Built up Areas data. Built-up Areas (BUAs) and Built-up Area Sub-divisions (BUASDs) are defined as land that is “irreversibly urban in character”, including continuous urban development and any areas of intervening open space.
# load in BUA data
bua <- st_read('../data/bua_2011.geojson')
# and the RUC labelled LSOA data
lsoa <- st_read("../data/lsoa_boundaries_dover_2011_plus_ruc.geojson")
# do an st_join to find the BUAs that intersect the LSOAs
bua_lsoa <- st_join(bua, lsoa, join = st_intersects,left=F)
# save these
out_fn <- "../data/bua_in_dover.geojson"
if(file.exists(out_fn)) {
file.remove(out_fn)
}
st_write(bua_lsoa,out_fn)
And we can then plot this:
library(tmap)
library(sf)
# load in buas in dover
bua_dover <- st_read("../data/bua_in_dover.geojson",quiet=T)
# increase max.categories otherwise we can only show a few different boundaries
tmap_options(max.categories=100)
tmap_mode("view")
# create the map
tmap_map <- tm_basemap("OpenStreetMap") +
tm_shape(bua_dover) +
tm_polygons("BUA11NM",alpha=0.5,legend.show=F)
tmap_map
library(tmap)
library(sf)
# load in the southeast boundaries
sebounds <- st_read("../data/southeast_boundary.geojson")
## Reading layer `southeast_boundary' from data source
## `/home/ash/work/coastal/data/southeast_boundary.geojson' using driver `GeoJSON'
## Simple feature collection with 1 feature and 7 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: 403095.4 ymin: 75256.6 xmax: 640171.2 ymax: 256158.2
## Projected CRS: OSGB 1936 / British National Grid
tmap_mode("view")
# create the map
se_bounds_map <- tm_basemap("OpenStreetMap") +
tm_shape(sebounds) +
tm_borders(lwd=2,col="red")
se_bounds_map